package com.example.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 *用于配置 Web MVC 的静态资源处理
 */
@Configuration
public class ResourcesConfig implements WebMvcConfigurer {

    /**
     * 配置静态资源的处理规则
     * @param registry
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry){
        /** 本地文件上传路径 */
        registry.addResourceHandler("upload/**")
                .addResourceLocations("file:D:\\tmp/");
    }

}
